from QuantLib import *
d1 = QuantLib.Date(24,10,2011)
d2 = QuantLib.Date(24,10,2012)
v1 = 25.0
v2 = 23.5
strike = 20.0
maturity = d2
d=[d1,d2]
v=[v1,v2]
name = 'rate'
type = 'CALL'
payoffType = 'PayoffsVanillaOption'
obs = QuantLib.Observables(d)
obs.PushObservable(name,v)
po = QuantLib.PayoffFactory.instance().CreatePayoff(payoffType)
QuantLib.PayoffFactory.instance().setDouble(po, 'strike',strike)
QuantLib.PayoffFactory.instance().setString(po, 'optionType',type)
QuantLib.PayoffFactory.instance().setString(po, 'variableName',name)
cf = QuantLib.AMCCashflows()
cf.PushCashflow(d2, po)
cf.GetCashflow(d2, obs)